import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:tiktokadult/assets_tool/app_colors.dart';
import 'package:tiktokadult/hj_utils/widget_utils.dart';

import '../../routers/jump_router.dart';

/// 显示vipdialog isJump 是否在dialog 内部处理跳转事件
Future<int?> showVipLevelDialog(
  String content, {
  String buttonTitle = '立即开通',
  Function? vipEvent,
}) {
  return Get.dialog(
    barrierColor: Colors.black.withOpacity(.4),
    barrierDismissible: true,
    Container(
      alignment: Alignment.center,
      margin: EdgeInsets.symmetric(horizontal: 32),
      child: Material(
        color: Colors.transparent,
        child: Container(
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(12),
            color: Color(0xff050f17),
          ),
          padding: const EdgeInsets.fromLTRB(18, 32, 18, 24),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Text(
                "溫馨提示",
                style: TextStyle(
                  fontSize: 20,
                  color: Color(0xE5FFFFFF),
                  fontWeight: FontWeight.w500,
                ),
              ),
              12.sizeBoxH,
              0.5.line,
              12.sizeBoxH,
              Container(
                padding: EdgeInsets.symmetric(horizontal: 4),
                alignment: Alignment.center,
                child: Text(
                  content,
                  textAlign: TextAlign.center,
                  style: TextStyle(fontSize: 16, color: Color(0x73FFFFFF), height: 1.5),
                ),
              ),
              24.sizeBoxH,
              InkWell(
                onTap: () {
                  if (vipEvent != null) {
                    vipEvent.call();
                  } else {
                    jumpToWalletPage(tabPosition: 0);
                  }
                },
                child: Container(
                  alignment: Alignment.center,
                  height: 44,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(3),
                    color: Color(0xffE1351F),
                  ),
                  child: Text(
                    buttonTitle,
                    style: TextStyle(
                      fontSize: 16,
                      color: Colors.white,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    ),
  );
}
